package com.junzhiit.nengji.shop.web.util.printing.enums;

public enum ResultErrorStatus {
	SUCCESS(0,"success"),
	RESPONSE_TYPE_ILLEGAL(1,"response_type非法"),
	CLIENT_ID_NOT_EXIST(2,"client_id不存在"),
	REDIRECT_URI_MIS_MATCH(3,"redirect_uri不匹配"),
	NO_NULLS_ALLOWED(4,"client_id、response_type、state均不允许为空"),
	CLIENT_INFO_ERROR(5,"client_id或client_secret错误"),
	CODE_ERROR(6,"code错误或已过期"),
	WRONG_PASSWORD(7,"code错误或已过期"),
	PRINTER_INFO_ERROR(8,"打印机信息错误,参数有误"),
	PRINTER_CONNECT_FAILED(9,"连接打印机失败,参数有误"),
	INSUFFICIENT_PERMISSIONS(10,"权限不足"),
	SIGN_VALIDATION_FAILED(11,"sign验证失败"),
	LACK_OF_PARAMETERS(12,"缺少必要参数"),
	PRINT_FAILED(13,"打印失败,参数有误"),
	ACCESS_TOKEN_ERROR(14,"打印失败,参数有误"),
	BEYOND_FIRST_PERMISSIONS(15,"权限不能大于初次授权的权限"),
	NOT_SUPPORT_MODELS(16,"不支持k1,k2,k3机型"),
	HAS_BE_BOUND(17,"该打印机已被他人绑定"),
	ACCESS_TOKEN_EXPIRED(18,"access_token过期或错误,请刷新access_token或者重新授权"),
	APPLICATIONS_ON_OR_OFF_SHELVES(19,"应用未上架或已下架"),
	REFRESH_TOKEN_EXPIRED(20,"refresh_token已过期,请重新授权"),
	SHUTDOWN_FAILED(21,"关闭或重启失败"),
	SET_VOICE_FAILED(22,"声音设置失败"),
	MODELS_INFO_FAILED(23,"获取机型和打印宽度失败"),
	NOT_ORDERS_CANCEL(24,"操作失败，没有订单可以被取消"),
	MODELS_NOT_FOUND(25,"未找到机型的硬件和软件版本"),
	CANCEL_LOGO_FAILED(26,"取消logo失败"),
	PERMISSIONS_SCOPE_ALL(27,"请设置scope,权限默认为all"),
	SET_LOGO_FAILED(28,"设置logo失败"),
	PARAMS_NOT_NULL(29,"client_id,machine_code,qr_key不能为空"),
	MACHINE_CODE_QR_KEY_ERROR(30,"machine_code,qr_key错误"),
	NOT_SUPPORT_PROPRIETARY_APPLICATION(31,"接口不支持自有应用服务模式"),
	SET_ORDER_CONFIRM_FAILED(32,"订单确认设置失败"),
	UUID_ILLEGAL(33,"uuid不合法"),
	OPERATION_ILLEGAL(34,"非法操作"),
	MACHINE_CODE_MSIGN_ERROR(35,"machine_code或msign错误"),
	PRINT_ON_OR_OFF_FAILED(36,"按键打印开启或关闭失败"),
	ADD_APPLICATION_MENU_FAILED(37,"添加应用菜单失败"),
	APPLYING_MENU_ERROR(38,"应用菜单内容错误,content必须是Json数组"),
	APPLICATION_OVERCOUNT(39,"应用菜单个数超过最大个数"),
	APPLICATION_CONTENT_NAME_REPEAT(40,"应用菜单内容错误,content中的name值重名"),
	ACCESS_TOKEN_OVERCOUNT(41,"获取或更新access_token的次数,已超过最大限制次数!"),
	MODELS_NOT_SUPPORT_PRINT(42,"该机型不支持面单打印"),
	SHIPPER_TYPE_ERROR(43,"shipper_type错误"),
	SYSTEM_ERROR(45,"系统错误!请立即反馈"),
	PICTURE_URL_ERROR(46,"picture_url错误或格式错误"),
	PARAMS_ERROR(47,"参数错误"),
	MODEL_NOT_SUPPORT(48,"无法设置,该型号版本不支持!"),
	ERROR(49,"错误");
	
	
	
	private Integer status;
	
	private String value;

	private ResultErrorStatus(Integer status,String value){
		this.status = status;
		this.value = value;
	}

	public int toIntStatus() {
		return this.status;
	}
	
	public String toStringValue() {
		return this.value;
	}
	
	public static ResultErrorStatus getError(int status) {
		for (ResultErrorStatus error : values()) {
			if(status == error.toIntStatus()) {
				return error;
			}
		}
		return null;
	}
}
